Project By:
Premjeet Kumar https://www.linkedin.com/in/premjeet-kumar/
Hari Samynaath S https://www.linkedin.com/in/harinaathan/
Veena Raju https://www.linkedin.com/in/veena-raju-1b16b513b/
Javed Bhai https://www.linkedin.com/in/javedbhai/
Surabhi Joshi https://www.linkedin.com/in/surabhi-joshi-4452788/
Project For:
Captstone project for Post Graduate Program in Artificial Intelligence and Machine Learning
with GreatLakes & Texas McCombs School of Business, The University of Texas at Austin
CONTEXT:
Computer vision can be used to automate supervision and generate action appropriate action trigger if the event is predicted from the image of interest. For example a car moving on the road can be easily identi ied by a camera as make of the car, type, colour, number plates etc.
DATA DESCRIPTION:
The Cars dataset contains 16,185 images of 196 classes of cars. The data is split into 8,144 training images and 8,041 testing images, where each class has been split roughly in a 50-50 split. Classes are typically at the level of Make, Model, Year, e.g. 2012 Tesla Model S or 2012 BMW M3 coupe.
‣ Train Images: Consists of real images of cars as per the make and year of the car.
‣ Test Images: Consists of real images of cars as per the make and year of the car.
‣ Train Annotation: Consists of bounding box region for training images.
‣ Test Annotation: Consists of bounding box region for testing images.
‣ Step 1: Import the data
‣ Step 2: Map training and testing images to its classes.
‣ Step 3: Map training and testing images to its annotations.
‣ Step 4: Display images with bounding box
‣ Output: Images mapped to its class and annotation ready to be used for deep learning
‣ Input: Output of milestone 1
‣ Step 1: Design, train and test CNN models to classify the car.
‣ Step 2: Design, train and test RCNN & its hybrids based object detection models to impose the bounding box or
mask over the area of interest.
‣ Output: Pickled model to be used for future prediction
import tensorflow as tf
import numpy as np
import os, pickle, re
import pandas as pd
import warnings
warnings.filterwarnings("ignore")
pd.set_option('display.max_columns', 50)
# import models to environment
from tensorflow.keras.optimizers import Adagrad,Adam,SGD,RMSprop
from tensorflow.keras import regularizers
from tensorflow.keras.applications.vgg16 import VGG16
from tensorflow.keras.applications.vgg19 import VGG19
from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2
from tensorflow.keras.applications.inception_v3 import InceptionV3
from tensorflow.keras.applications.resnet_v2 import ResNet152V2,ResNet50V2,ResNet101V2
from tensorflow.keras.applications.efficientnet_v2 import EfficientNetV2B0,EfficientNetV2B1,EfficientNetV2B2,EfficientNetV2B3
from tensorflow.keras.applications.efficientnet_v2 import EfficientNetV2S,EfficientNetV2M,EfficientNetV2L
from tensorflow.keras.applications.densenet import DenseNet169,DenseNet201,DenseNet121
from tensorflow.keras.applications.nasnet import NASNetMobile
# list down parameters and the test ranges
optims = [Adam(), SGD(momentum=0.1)]
patiences = [4,8]
slopes = [0.3,0.5]
factors = [0.1,0.3]
uFreezePercents = [0,0.3,0.7]
learningRates = [1e-3,1e-7]
lossBalancing = [0.2,0.8]
dOuts = [0.5,0.7]
lmbdas = [0.1,0.01]
# create grid of parameters
pGrid = [{'optimizer':o,
'patience':p,'slope':s,'factor':f,
'unFreezeRatio':r,
'learning_rate':lr,'lossBalance':lb,
'dropOut':do,'lmbda':lmb}
for o in optims
for p in patiences for s in slopes for f in factors
for r in uFreezePercents
for lr in learningRates for lb in lossBalancing
for do in dOuts for lmb in lmbdas
]
print("Parameter grid count: {:,d}".format(len(pGrid)))
Parameter grid count: 768
# define a transfer learning network mapped to our targets
def transferNET(application,input_size,dOut,lmbda):
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input,GlobalMaxPool2D,Dense,BatchNormalization,Dropout
# Random consistency seed
tf.random.set_seed(100)
# load application
tNet = application(input_shape=input_size[1:],include_top=False, weights='imagenet')
# flatten with pooling
pool = GlobalMaxPool2D(name="CustomLayerStart")(tNet.output)
# classifier branch for car names
nameBranch = Dense(512,activation='relu',kernel_regularizer=regularizers.l2(lmbda))(pool)
Nbn1 = BatchNormalization()(nameBranch)
Ndo1 = Dropout(dOut)(Nbn1)
Nhid1 = Dense(256,activation='relu',kernel_regularizer=regularizers.l2(lmbda))(Ndo1)
Nbn2 = BatchNormalization()(Nhid1)
Ndo2 = Dropout(dOut)(Nbn2)
classifier = Dense(196,activation='softmax',name="names")(Ndo2)
# regression branch for bounding boxes
boxBranch = Dense(64,activation='relu',kernel_regularizer=regularizers.l2(lmbda))(pool)
Bbn1 = BatchNormalization()(boxBranch)
Bdo1 = Dropout(dOut)(Bbn1)
Bhid1 = Dense(32,activation='relu',kernel_regularizer=regularizers.l2(lmbda))(Bdo1)
Bbn2 = BatchNormalization()(Bhid1)
Bdo2 = Dropout(dOut)(Bbn2)
bBox = Dense(4,activation='relu',name="boxes")(Bdo2)
# assemble the network
model = Model(inputs=tNet.inputs,outputs=[classifier,bBox])
# freeze application layers and open classifer & regressor for training
for layer in model.layers[:-15]:
layer.trainable = False
return model
models = [VGG16,VGG19,MobileNetV2,ResNet50V2,EfficientNetV2S,DenseNet201,NASNetMobile]
compareResults=pd.DataFrame()
for model in models:
fname = os.path.join('deployables',model.__name__,"%s_attrib.gl"%model.__name__)
with open(fname, 'rb') as fh:
attributes = pickle.load(fh)
"""if compareResults.shape[0]==0:
compareResults = pd.DataFrame(columns=list(attributes['evalResults'].keys()),dtype=object)"""
compareResults = compareResults.append(attributes['evalResults'],ignore_index=True)
compareResults
| name | target_size | batch_size | optimizer | patience | slope | factor | learning_rate | lossWeights | epochs | verbose | logs | loss | names_loss | boxes_loss | names_CategoricalAccuracy | names_Precision | names_Recall | boxes_IoU | val_loss | val_names_loss | val_boxes_loss | val_names_CategoricalAccuracy | val_names_Precision | val_names_Recall | val_boxes_IoU | steps_per_epoch | validation_steps | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | VGG16 | (224, 224) | 32 | Adam | 15 | 0.15 | 0.1 | 0.001 | {'names': 0.5, 'boxes': 0.5} | 30 | 1 | {'loss': [5.587075233459473, 3.966358661651611... | 0.844168 | 0.831028 | 0.013140 | 0.859375 | 0.978552 | 0.656742 | 0.646943 | 2.857366 | 2.844716 | 0.012650 | 0.327067 | 0.650644 | 0.163471 | 0.651080 | NaN | NaN |
| 1 | VGG19 | (224, 224) | 32 | Adam | 15 | 0.15 | 0.1 | 0.001 | {'names': 0.5, 'boxes': 0.5} | 30 | 1 | {'loss': [5.638175010681152, 4.074068546295166... | 0.952510 | 0.937004 | 0.015506 | 0.838091 | 0.980834 | 0.604454 | 0.618246 | 3.030715 | 3.015413 | 0.015301 | 0.303909 | 0.626506 | 0.135956 | 0.620036 | NaN | NaN |
| 2 | MobileNetV2 | (224, 224) | 32 | Adam | 15 | 0.15 | 0.1 | 0.001 | {'names': 0.5, 'boxes': 0.5} | 30 | 1 | {'loss': [5.118948459625244, 3.445307493209839... | 0.452112 | 0.440491 | 0.011621 | 0.928765 | 0.982900 | 0.869833 | 0.650052 | 2.506006 | 2.494308 | 0.011697 | 0.389442 | 0.670391 | 0.224104 | 0.647654 | NaN | NaN |
| 3 | ResNet50V2 | (224, 224) | 32 | Adam | 15 | 0.15 | 0.1 | 0.001 | {'names': 0.5, 'boxes': 0.5} | 30 | 1 | {'loss': [5.000739574432373, 3.436673164367676... | 0.369423 | 0.350934 | 0.018489 | 0.935778 | 0.981474 | 0.912525 | 0.587236 | 2.480897 | 2.462386 | 0.018511 | 0.408989 | 0.657504 | 0.259089 | 0.589307 | NaN | NaN |
| 4 | EfficientNetV2S | (224, 224) | 32 | Adam | 15 | 0.15 | 0.1 | 0.001 | {'names': 0.5, 'boxes': 0.5} | 30 | 1 | {'loss': [5.972702503204346, 5.568402290344238... | 4.983481 | 4.955740 | 0.027741 | 0.037032 | 0.000000 | 0.000000 | 0.511724 | 5.245408 | 5.218029 | 0.027380 | 0.016434 | 0.000000 | 0.000000 | 0.514779 | NaN | NaN |
| 5 | DenseNet201 | (224, 224) | 32 | Adam | 15 | 0.15 | 0.1 | 0.001 | {'names': 0.5, 'boxes': 0.5} | 2 | 1 | {'loss': [5.747513771057129, 4.238009452819824... | 3.653059 | 3.343921 | 0.309137 | 0.230315 | 0.659529 | 0.037894 | 0.004085 | 4.151174 | 3.840998 | 0.310175 | 0.139940 | 0.412234 | 0.019298 | 0.029028 | 100.0 | 10.0 |
| 6 | NASNetMobile | (224, 224) | 32 | Adam | 15 | 0.15 | 0.1 | 0.001 | {'names': 0.5, 'boxes': 0.5} | 30 | 1 | {'loss': [4.982983589172363, 3.866465091705322... | 1.269307 | 1.258898 | 0.010408 | 0.728716 | 0.958167 | 0.414247 | 0.667567 | 2.815521 | 2.804810 | 0.010710 | 0.305154 | 0.639756 | 0.117405 | 0.665775 | NaN | NaN |
KPIs = compareResults[['name','loss','names_CategoricalAccuracy','boxes_IoU',
'val_loss','val_names_CategoricalAccuracy','val_boxes_IoU']]
KPIs.sort_values(by='val_names_CategoricalAccuracy',ascending=False)
| name | loss | names_CategoricalAccuracy | boxes_IoU | val_loss | val_names_CategoricalAccuracy | val_boxes_IoU | |
|---|---|---|---|---|---|---|---|
| 3 | ResNet50V2 | 0.369423 | 0.935778 | 0.587236 | 2.480897 | 0.408989 | 0.589307 |
| 2 | MobileNetV2 | 0.452112 | 0.928765 | 0.650052 | 2.506006 | 0.389442 | 0.647654 |
| 0 | VGG16 | 0.844168 | 0.859375 | 0.646943 | 2.857366 | 0.327067 | 0.651080 |
| 6 | NASNetMobile | 1.269307 | 0.728716 | 0.667567 | 2.815521 | 0.305154 | 0.665775 |
| 1 | VGG19 | 0.952510 | 0.838091 | 0.618246 | 3.030715 | 0.303909 | 0.620036 |
| 5 | DenseNet201 | 3.653059 | 0.230315 | 0.004085 | 4.151174 | 0.139940 | 0.029028 |
| 4 | EfficientNetV2S | 4.983481 | 0.037032 | 0.511724 | 5.245408 | 0.016434 | 0.514779 |
from lib.networkPipe import Pipe
2022-07-31 14:00:48.023382: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-07-31 14:00:48.049584: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-07-31 14:00:48.049842: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-07-31 14:00:48.050442: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-07-31 14:00:48.050906: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-07-31 14:00:48.051185: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-07-31 14:00:48.051315: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-07-31 14:00:48.415168: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-07-31 14:00:48.415373: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-07-31 14:00:48.415484: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:975] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2022-07-31 14:00:48.415576: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 3203 MB memory: -> device: 0, name: Quadro P1000, pci bus id: 0000:01:00.0, compute capability: 6.1
logdir = "logs"
%load_ext tensorboard
%tensorboard --logdir logs
gIndex = np.arange(len(pGrid))
for index in np.random.choice(gIndex,30,replace=False):
print("gridPosition used : %03d"%index)
gPoint = pGrid[index]
# generator parameters
gParams = dict(target_size=(224,224),batch_size=32)
# model creation parameters
mParams = dict(application=ResNet50V2,dOut=gPoint.get('dropOut'),lmbda=gPoint.get('lmbda'))
# optimiser for compilation
optim = gPoint.get('optimizer')
# lr scheduler parameters
lrParams = dict(patience=gPoint.get('patience'),slope=gPoint.get('slope'),factor=gPoint.get('factor'))
# earlyStop parameters
#eSparams = dict(patience=int(gPoint.get('patience')*3.1),slope=gPoint.get('slope')*0.5)
eSparams = dict()
# model fitting parameters
fParams = dict(epochs=30,verbose=0,steps_per_epoch=50,validation_steps=10)
# trainability scheduler parameters
if gPoint.get('unFreezeRatio')==0:
trParams = dict()
else:
trParams = dict(uncontrolled=-15,schedule={int(gPoint.get('patience')*2.8):gPoint.get('unFreezeRatio')})
# other hyper parameters
lRate = gPoint.get('learning_rate')
lBalance = gPoint.get('lossBalance')
gridPoint = dict(learning_rate=lRate,lossWeights={'names':lBalance,'boxes':1-lBalance})
pp = Pipe(generatorParams=gParams,modelFunc=transferNET,modelName="ResNet50V2_hTune_%03d"%index,modelParams=mParams)
pp.compiler(optim=optim,lrScheduleParams=lrParams,eStopParams=eSparams,
trainabilityParams=trParams,gridPoint=gridPoint,sBest=False)
pp.fit(gridPoint=gridPoint,fitParams=fParams)
pp.evaluate()
pp.htuneSave()
gridPosition used : 489
imScanTrain: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 196/196 [00:04<00:00, 47.64it/s] imScanTest: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 196/196 [00:03<00:00, 53.40it/s] 2022-07-30 00:32:38.326589: W tensorflow/core/platform/profile_utils/cpu_utils.cc:128] Failed to get CPU frequency: 0 Hz 2022-07-30 00:32:40.018558: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 00:33:10.028114: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 487
2022-07-30 00:55:47.512971: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 00:56:16.839976: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 146
2022-07-30 01:19:09.548922: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 01:19:40.540491: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 672
2022-07-30 01:42:54.852345: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 01:43:24.809501: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 323
2022-07-30 02:06:30.394239: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 02:07:01.609770: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 758
2022-07-30 02:30:26.503942: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 02:30:56.733865: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 123
2022-07-30 02:53:57.342220: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 02:54:28.164741: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 643
2022-07-30 03:17:31.700605: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 03:18:02.071899: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 588
2022-07-30 03:41:00.600867: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 03:41:31.449377: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 097
2022-07-30 04:04:47.923868: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 04:05:17.612968: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 622
2022-07-30 04:28:41.150176: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 04:29:10.795849: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 132
2022-07-30 04:52:45.528712: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 04:53:16.602101: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 661
2022-07-30 05:16:41.133705: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 05:17:12.871830: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 689
2022-07-30 05:40:35.326024: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 05:41:06.266506: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 279
2022-07-30 06:04:17.981954: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 06:04:49.245426: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 750
2022-07-30 06:27:57.965199: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 06:28:28.111382: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 545
2022-07-30 06:51:36.246675: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 06:52:06.573275: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 516
2022-07-30 07:15:26.421792: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 07:15:56.859499: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 164
2022-07-30 07:39:13.704803: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 07:39:45.410792: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 043
2022-07-30 08:03:14.665465: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 08:03:47.117854: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 280
2022-07-30 08:27:32.191586: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 08:28:02.864992: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 281
2022-07-30 08:51:45.417142: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 08:52:16.936634: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 717
2022-07-30 09:16:05.382913: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 09:16:37.109896: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 526
2022-07-30 09:40:09.228798: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 09:40:41.263332: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 755
2022-07-30 10:04:06.632067: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 10:04:37.544375: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 562
2022-07-30 10:28:08.456790: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 10:28:39.289292: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 539
2022-07-30 10:51:21.774174: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 10:51:52.093384: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 042
2022-07-30 11:14:39.770655: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 11:15:11.939027: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 582
2022-07-30 11:38:29.403042: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 11:39:00.873826: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
gridPosition used : 002
2022-07-30 12:02:11.071999: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-07-30 12:02:42.897864: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
dirList = os.listdir('./deployables/')
tuneList = [os.path.join('./deployables',fname)
for fname in dirList
if re.search(r'(hTune)',fname)
and re.search(r'(attrib.gl)',fname)]
tuneLog = pd.DataFrame()
for fname in tuneList:
with open(fname, 'rb') as fh:
attributes = pickle.load(fh)
tuneLog = tuneLog.append(attributes['evalResults'],ignore_index=True)
KPIs = tuneLog[['name','loss','names_CategoricalAccuracy','boxes_IoU',
'val_loss','val_names_CategoricalAccuracy','val_boxes_IoU']]
KPIs.sort_values(by='val_names_CategoricalAccuracy',ascending=False)
| name | loss | names_CategoricalAccuracy | boxes_IoU | val_loss | val_names_CategoricalAccuracy | val_boxes_IoU | |
|---|---|---|---|---|---|---|---|
| 7 | ResNet50V2_hTune_357 | 3.096646 | 0.516609 | 0.647384 | 3.713136 | 0.309512 | 0.648093 |
| 23 | ResNet50V2_hTune_213 | 4.162242 | 0.515010 | 0.395893 | 4.792305 | 0.303909 | 0.399777 |
| 22 | ResNet50V2_hTune_164 | 3.724387 | 0.362082 | 0.606193 | 4.090173 | 0.223481 | 0.609967 |
| 50 | ResNet50V2_hTune_097 | 4.609859 | 0.317667 | 0.508563 | 4.932710 | 0.217505 | 0.512276 |
| 30 | ResNet50V2_hTune_279 | 4.098151 | 0.301058 | 0.481427 | 4.343278 | 0.213770 | 0.482655 |
| 20 | ResNet50V2_hTune_132 | 4.763387 | 0.244094 | 0.572507 | 4.990209 | 0.183391 | 0.576064 |
| 5 | ResNet50V2_hTune_323 | 4.761096 | 0.245940 | 0.400854 | 4.944709 | 0.182271 | 0.404170 |
| 4 | ResNet50V2_hTune_291 | 4.787927 | 0.240773 | 0.456392 | 4.985533 | 0.180777 | 0.465225 |
| 21 | ResNet50V2_hTune_146 | 6.324769 | 0.252584 | 0.013193 | 6.519183 | 0.174801 | 0.012665 |
| 18 | ResNet50V2_hTune_102 | 5.848691 | 0.136319 | 0.281144 | 5.945723 | 0.115289 | 0.289173 |
| 0 | ResNet50V2_hTune_002 | 5.572777 | 0.136811 | 0.296225 | 5.664396 | 0.109437 | 0.297342 |
| 39 | ResNet50V2_hTune_661 | 18.329708 | 0.029158 | 0.015101 | 18.433784 | 0.019671 | -0.041360 |
| 43 | ResNet50V2_hTune_705 | 18.430031 | 0.024360 | -0.005257 | 18.544445 | 0.017804 | -0.163723 |
| 40 | ResNet50V2_hTune_672 | 109.464905 | 0.023499 | 0.026671 | 109.588593 | 0.016434 | -0.092030 |
| 44 | ResNet50V2_hTune_709 | 18.413792 | 0.023130 | -0.003484 | 18.497936 | 0.015189 | -0.020716 |
| 42 | ResNet50V2_hTune_689 | 18.469704 | 0.020300 | -0.086530 | 18.557299 | 0.014318 | -0.000630 |
| 38 | ResNet50V2_hTune_643 | 18.459730 | 0.017963 | -0.026938 | 18.516497 | 0.014193 | 0.019272 |
| 48 | ResNet50V2_hTune_758 | 103.801414 | 0.016855 | -0.064730 | 103.871284 | 0.013944 | 0.036628 |
| 33 | ResNet50V2_hTune_582 | 109.715393 | 0.014764 | -0.035304 | 109.772369 | 0.013073 | 0.015242 |
| 47 | ResNet50V2_hTune_755 | 18.503374 | 0.016486 | -0.047379 | 18.565781 | 0.012824 | -0.114791 |
| 17 | ResNet50V2_hTune_545 | 18.663509 | 0.016609 | -0.005747 | 18.740150 | 0.012201 | -0.026340 |
| 51 | ResNet50V2_hTune_562 | 116.498932 | 0.012672 | -0.168092 | 116.531418 | 0.011205 | 0.034437 |
| 34 | ResNet50V2_hTune_583 | 18.495226 | 0.012918 | 0.043513 | 18.552563 | 0.010334 | 0.033378 |
| 13 | ResNet50V2_hTune_514 | 120.375450 | 0.008858 | 0.002731 | 120.406662 | 0.009711 | -0.008530 |
| 10 | ResNet50V2_hTune_487 | 18.823624 | 0.009843 | -0.026517 | 18.851259 | 0.008964 | 0.002790 |
| 14 | ResNet50V2_hTune_516 | 120.422836 | 0.013287 | -0.028129 | 120.495956 | 0.008964 | -0.116535 |
| 8 | ResNet50V2_hTune_439 | 18.653530 | 0.010089 | -0.039540 | 18.687246 | 0.007844 | 0.071707 |
| 12 | ResNet50V2_hTune_511 | 19.170870 | 0.005167 | 0.029037 | 19.167377 | 0.006599 | 0.085640 |
| 29 | ResNet50V2_hTune_270 | 137.937729 | 0.004798 | 0.058051 | 137.935181 | 0.006599 | 0.120691 |
| 26 | ResNet50V2_hTune_223 | 19.146347 | 0.005413 | -0.025036 | 19.145479 | 0.006474 | -0.114905 |
| 24 | ResNet50V2_hTune_219 | 19.155247 | 0.005044 | 3.815772 | 19.152126 | 0.006474 | 0.041418 |
| 35 | ResNet50V2_hTune_587 | 19.170319 | 0.005167 | 0.044977 | 19.166660 | 0.006474 | 0.917248 |
| 1 | ResNet50V2_hTune_010 | 138.075211 | 0.004921 | -3.453720 | 138.071732 | 0.006350 | -0.404825 |
| 49 | ResNet50V2_hTune_762 | 138.384766 | 0.004675 | 0.088330 | 138.382492 | 0.006101 | 0.376361 |
| 6 | ResNet50V2_hTune_330 | 177.489014 | 0.004675 | 6.251137 | 177.330978 | 0.005976 | 4.197583 |
| 27 | ResNet50V2_hTune_232 | 138.105576 | 0.005536 | -2.019621 | 138.103317 | 0.005852 | 0.651765 |
| 41 | ResNet50V2_hTune_681 | 19.364851 | 0.005536 | 0.215715 | 19.361935 | 0.005852 | 0.171500 |
| 3 | ResNet50V2_hTune_043 | 19.179884 | 0.005906 | 0.070257 | 19.181965 | 0.005603 | -0.066094 |
| 28 | ResNet50V2_hTune_233 | 19.342075 | 0.005659 | -0.291289 | 19.343296 | 0.005603 | 0.020349 |
| 25 | ResNet50V2_hTune_220 | 138.112259 | 0.005044 | -0.335361 | 138.109329 | 0.005603 | -0.057849 |
| 46 | ResNet50V2_hTune_750 | 138.605545 | 0.005044 | 0.106731 | 138.608398 | 0.005478 | 0.289205 |
| 9 | ResNet50V2_hTune_445 | 19.363623 | 0.005659 | 0.168821 | 19.359472 | 0.005478 | -6.152737 |
| 37 | ResNet50V2_hTune_622 | 138.613068 | 0.005290 | 0.118651 | 138.614532 | 0.005478 | -0.029541 |
| 32 | ResNet50V2_hTune_281 | 19.370234 | 0.004921 | 0.115642 | 19.381521 | 0.005478 | -0.269149 |
| 16 | ResNet50V2_hTune_539 | 19.186636 | 0.004921 | 2.096231 | 19.190557 | 0.005354 | 0.050004 |
| 15 | ResNet50V2_hTune_526 | 138.612183 | 0.005044 | 0.080575 | 138.614792 | 0.005354 | -0.337572 |
| 2 | ResNet50V2_hTune_042 | 138.296600 | 0.005290 | -3.407888 | 138.299850 | 0.005354 | -0.102929 |
| 11 | ResNet50V2_hTune_489 | 19.385286 | 0.004921 | 0.286832 | 19.393044 | 0.005105 | 0.046976 |
| 36 | ResNet50V2_hTune_588 | 138.818680 | 0.005044 | 0.135574 | 138.826462 | 0.005105 | 0.019738 |
| 31 | ResNet50V2_hTune_280 | 138.274414 | 0.004552 | 0.345136 | 138.284317 | 0.005105 | 0.488681 |
| 45 | ResNet50V2_hTune_717 | 19.394646 | 0.004552 | 0.507070 | 19.399637 | 0.004980 | -0.084612 |
| 19 | ResNet50V2_hTune_123 | 19.180258 | 0.005413 | 0.266682 | 19.185755 | 0.004980 | 0.032024 |
pGrid[357]
{'optimizer': <keras.optimizers.optimizer_v2.adam.Adam at 0x7f69582c7ee0>,
'patience': 8,
'slope': 0.5,
'factor': 0.3,
'unFreezeRatio': 0.3,
'learning_rate': 0.001,
'lossBalance': 0.8,
'dropOut': 0.5,
'lmbda': 0.01}
index=357
gPoint = pGrid[index]
# generator parameters
gParams = dict(target_size=(224,224),batch_size=32)
# model creation parameters
mParams = dict(application=ResNet50V2,dOut=gPoint.get('dropOut'),lmbda=gPoint.get('lmbda'))
# optimiser for compilation
optim = gPoint.get('optimizer')
# lr scheduler parameters
lrParams = dict(patience=gPoint.get('patience'),slope=gPoint.get('slope'),factor=gPoint.get('factor'))
# earlyStop parameters
eSparams = dict(patience=int(gPoint.get('patience')*3.1),slope=gPoint.get('slope')*0.5)
# model fitting parameters
fParams = dict(epochs=40,verbose=1)
# trainability scheduler parameters
if gPoint.get('unFreezeRatio')==0:
trParams = dict()
else:
trParams = dict(uncontrolled=-15,schedule={int(gPoint.get('patience')*2.8):gPoint.get('unFreezeRatio')})
# other hyper parameters
lRate = gPoint.get('learning_rate')
lBalance = gPoint.get('lossBalance')
gridPoint = dict(learning_rate=lRate,lossWeights={'names':lBalance,'boxes':1-lBalance})
pp = Pipe(generatorParams=gParams,modelFunc=transferNET,modelName="ResNet50V2_FINAL",modelParams=mParams)
pp.compiler(optim=optim,lrScheduleParams=lrParams,eStopParams=eSparams,
trainabilityParams=trParams,gridPoint=gridPoint,sBest=False)
pp.fit(gridPoint=gridPoint,fitParams=fParams)
pp.evaluate()
pp.save()
pp.report()
imScanTrain: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 196/196 [00:03<00:00, 51.07it/s] imScanTest: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 196/196 [00:03<00:00, 52.80it/s]
Epoch 1/40
2022-07-30 16:00:58.213178: W tensorflow/core/platform/profile_utils/cpu_utils.cc:128] Failed to get CPU frequency: 0 Hz 2022-07-30 16:00:59.958693: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
229/229 [==============================] - ETA: 0s - loss: 13.3685 - names_loss: 5.1055 - boxes_loss: 0.6026 - names_CategoricalAccuracy: 0.0424 - names_Precision: 0.2404 - names_Recall: 0.0034 - boxes_IoU: -0.0935
2022-07-30 16:03:12.492087: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
229/229 [==============================] - 151s 638ms/step - loss: 13.3685 - names_loss: 5.1055 - boxes_loss: 0.6026 - names_CategoricalAccuracy: 0.0424 - names_Precision: 0.2404 - names_Recall: 0.0034 - boxes_IoU: -0.0935 - val_loss: 9.4936 - val_names_loss: 4.2723 - val_boxes_loss: 0.2507 - val_names_CategoricalAccuracy: 0.0925 - val_names_Precision: 0.6667 - val_names_Recall: 0.0075 - val_boxes_IoU: 0.0758 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 151.0182 Epoch 2/40 229/229 [==============================] - 148s 648ms/step - loss: 8.0431 - names_loss: 4.0030 - boxes_loss: 0.2577 - names_CategoricalAccuracy: 0.1161 - names_Precision: 0.3875 - names_Recall: 0.0127 - boxes_IoU: 0.0533 - val_loss: 6.9119 - val_names_loss: 3.8428 - val_boxes_loss: 0.1362 - val_names_CategoricalAccuracy: 0.1212 - val_names_Precision: 0.4762 - val_names_Recall: 0.0125 - val_boxes_IoU: 0.2473 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 148.4243 Epoch 3/40 229/229 [==============================] - 145s 634ms/step - loss: 6.2374 - names_loss: 3.6105 - boxes_loss: 0.1303 - names_CategoricalAccuracy: 0.1552 - names_Precision: 0.4567 - names_Recall: 0.0237 - boxes_IoU: 0.3130 - val_loss: 5.9422 - val_names_loss: 3.7712 - val_boxes_loss: 0.0357 - val_names_CategoricalAccuracy: 0.1312 - val_names_Precision: 0.3824 - val_names_Recall: 0.0162 - val_boxes_IoU: 0.4923 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 145.0111 Epoch 4/40 229/229 [==============================] - 145s 633ms/step - loss: 5.3820 - names_loss: 3.3799 - boxes_loss: 0.0613 - names_CategoricalAccuracy: 0.1953 - names_Precision: 0.5085 - names_Recall: 0.0328 - boxes_IoU: 0.4024 - val_loss: 5.4368 - val_names_loss: 3.6268 - val_boxes_loss: 0.0307 - val_names_CategoricalAccuracy: 0.1650 - val_names_Precision: 0.5962 - val_names_Recall: 0.0388 - val_boxes_IoU: 0.4930 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 144.9356 Epoch 5/40 229/229 [==============================] - 146s 636ms/step - loss: 4.8714 - names_loss: 3.1954 - boxes_loss: 0.0357 - names_CategoricalAccuracy: 0.2192 - names_Precision: 0.5275 - names_Recall: 0.0445 - boxes_IoU: 0.4930 - val_loss: 4.9950 - val_names_loss: 3.4277 - val_boxes_loss: 0.0255 - val_names_CategoricalAccuracy: 0.2050 - val_names_Precision: 0.6038 - val_names_Recall: 0.0400 - val_boxes_IoU: 0.5268 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 145.5701 Epoch 6/40 229/229 [==============================] - 145s 636ms/step - loss: 4.5483 - names_loss: 3.0709 - boxes_loss: 0.0260 - names_CategoricalAccuracy: 0.2380 - names_Precision: 0.5627 - names_Recall: 0.0588 - boxes_IoU: 0.5402 - val_loss: 4.9250 - val_names_loss: 3.4961 - val_boxes_loss: 0.0244 - val_names_CategoricalAccuracy: 0.1863 - val_names_Precision: 0.4746 - val_names_Recall: 0.0350 - val_boxes_IoU: 0.5511 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 145.4441 Epoch 7/40 229/229 [==============================] - 144s 631ms/step - loss: 4.3590 - names_loss: 2.9631 - boxes_loss: 0.0221 - names_CategoricalAccuracy: 0.2501 - names_Precision: 0.5931 - names_Recall: 0.0678 - boxes_IoU: 0.5642 - val_loss: 4.6417 - val_names_loss: 3.2594 - val_boxes_loss: 0.0262 - val_names_CategoricalAccuracy: 0.2250 - val_names_Precision: 0.5797 - val_names_Recall: 0.0500 - val_boxes_IoU: 0.5251 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 144.4364 Epoch 8/40 229/229 [==============================] - 145s 634ms/step - loss: 4.2745 - names_loss: 2.9165 - boxes_loss: 0.0201 - names_CategoricalAccuracy: 0.2672 - names_Precision: 0.5812 - names_Recall: 0.0757 - boxes_IoU: 0.5769 - val_loss: 4.7216 - val_names_loss: 3.3661 - val_boxes_loss: 0.0182 - val_names_CategoricalAccuracy: 0.1837 - val_names_Precision: 0.4375 - val_names_Recall: 0.0437 - val_boxes_IoU: 0.5798 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 145.1864 Epoch 9/40 229/229 [==============================] - 145s 632ms/step - loss: 4.1094 - names_loss: 2.7838 - boxes_loss: 0.0176 - names_CategoricalAccuracy: 0.2851 - names_Precision: 0.6039 - names_Recall: 0.0940 - boxes_IoU: 0.5942 - val_loss: 4.6738 - val_names_loss: 3.3673 - val_boxes_loss: 0.0182 - val_names_CategoricalAccuracy: 0.1725 - val_names_Precision: 0.5833 - val_names_Recall: 0.0262 - val_boxes_IoU: 0.5980 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 144.7306 Epoch 10/40 229/229 [==============================] - 145s 634ms/step - loss: 3.9685 - names_loss: 2.7039 - boxes_loss: 0.0166 - names_CategoricalAccuracy: 0.2982 - names_Precision: 0.6122 - names_Recall: 0.1013 - boxes_IoU: 0.6031 - val_loss: 4.5684 - val_names_loss: 3.3219 - val_boxes_loss: 0.0159 - val_names_CategoricalAccuracy: 0.1962 - val_names_Precision: 0.4368 - val_names_Recall: 0.0475 - val_boxes_IoU: 0.5989 - learning_rate: 0.0010 - Trainable: 15.0000 - lapTime: 145.1468 Epoch 11/40 229/229 [==============================] - 145s 635ms/step - loss: 3.3925 - names_loss: 2.2519 - boxes_loss: 0.0137 - names_CategoricalAccuracy: 0.4032 - names_Precision: 0.7711 - names_Recall: 0.1531 - boxes_IoU: 0.6301 - val_loss: 3.8086 - val_names_loss: 2.7547 - val_boxes_loss: 0.0166 - val_names_CategoricalAccuracy: 0.3212 - val_names_Precision: 0.6883 - val_names_Recall: 0.0662 - val_boxes_IoU: 0.5988 - learning_rate: 3.0000e-04 - Trainable: 15.0000 - lapTime: 145.4557 Epoch 12/40 229/229 [==============================] - 150s 655ms/step - loss: 3.0395 - names_loss: 2.0521 - boxes_loss: 0.0127 - names_CategoricalAccuracy: 0.4479 - names_Precision: 0.7793 - names_Recall: 0.1870 - boxes_IoU: 0.6432 - val_loss: 3.8984 - val_names_loss: 2.9639 - val_boxes_loss: 0.0130 - val_names_CategoricalAccuracy: 0.2525 - val_names_Precision: 0.5614 - val_names_Recall: 0.0400 - val_boxes_IoU: 0.6411 - learning_rate: 3.0000e-04 - Trainable: 15.0000 - lapTime: 149.9832 Epoch 13/40 229/229 [==============================] - 144s 630ms/step - loss: 2.8282 - names_loss: 1.9312 - boxes_loss: 0.0121 - names_CategoricalAccuracy: 0.4784 - names_Precision: 0.7882 - names_Recall: 0.2103 - boxes_IoU: 0.6496 - val_loss: 3.5944 - val_names_loss: 2.7280 - val_boxes_loss: 0.0122 - val_names_CategoricalAccuracy: 0.3113 - val_names_Precision: 0.6211 - val_names_Recall: 0.0737 - val_boxes_IoU: 0.6422 - learning_rate: 3.0000e-04 - Trainable: 15.0000 - lapTime: 144.2246 Epoch 14/40 229/229 [==============================] - 146s 638ms/step - loss: 2.6739 - names_loss: 1.8332 - boxes_loss: 0.0118 - names_CategoricalAccuracy: 0.5026 - names_Precision: 0.8043 - names_Recall: 0.2434 - boxes_IoU: 0.6545 - val_loss: 3.5363 - val_names_loss: 2.7157 - val_boxes_loss: 0.0125 - val_names_CategoricalAccuracy: 0.3225 - val_names_Precision: 0.6630 - val_names_Recall: 0.0763 - val_boxes_IoU: 0.6400 - learning_rate: 3.0000e-04 - Trainable: 15.0000 - lapTime: 146.0795 Epoch 15/40 229/229 [==============================] - 144s 630ms/step - loss: 2.5532 - names_loss: 1.7529 - boxes_loss: 0.0111 - names_CategoricalAccuracy: 0.5265 - names_Precision: 0.8121 - names_Recall: 0.2672 - boxes_IoU: 0.6599 - val_loss: 3.3768 - val_names_loss: 2.5915 - val_boxes_loss: 0.0109 - val_names_CategoricalAccuracy: 0.3262 - val_names_Precision: 0.6545 - val_names_Recall: 0.0900 - val_boxes_IoU: 0.6684 - learning_rate: 3.0000e-04 - Trainable: 15.0000 - lapTime: 144.4761 Epoch 16/40 229/229 [==============================] - 144s 631ms/step - loss: 2.4636 - names_loss: 1.6879 - boxes_loss: 0.0110 - names_CategoricalAccuracy: 0.5418 - names_Precision: 0.8109 - names_Recall: 0.2791 - boxes_IoU: 0.6612 - val_loss: 3.5229 - val_names_loss: 2.7588 - val_boxes_loss: 0.0097 - val_names_CategoricalAccuracy: 0.3200 - val_names_Precision: 0.5556 - val_names_Recall: 0.0750 - val_boxes_IoU: 0.6722 - learning_rate: 3.0000e-04 - Trainable: 15.0000 - lapTime: 144.2964 Epoch 17/40 229/229 [==============================] - 146s 636ms/step - loss: 2.3512 - names_loss: 1.5961 - boxes_loss: 0.0106 - names_CategoricalAccuracy: 0.5665 - names_Precision: 0.8377 - names_Recall: 0.3114 - boxes_IoU: 0.6667 - val_loss: 3.4201 - val_names_loss: 2.6732 - val_boxes_loss: 0.0107 - val_names_CategoricalAccuracy: 0.3125 - val_names_Precision: 0.6288 - val_names_Recall: 0.1037 - val_boxes_IoU: 0.6613 - learning_rate: 3.0000e-04 - Trainable: 15.0000 - lapTime: 145.4811 Epoch 18/40 229/229 [==============================] - 146s 638ms/step - loss: 2.2986 - names_loss: 1.5603 - boxes_loss: 0.0103 - names_CategoricalAccuracy: 0.5636 - names_Precision: 0.8225 - names_Recall: 0.3206 - boxes_IoU: 0.6669 - val_loss: 3.5708 - val_names_loss: 2.8150 - val_boxes_loss: 0.0333 - val_names_CategoricalAccuracy: 0.2862 - val_names_Precision: 0.5660 - val_names_Recall: 0.1125 - val_boxes_IoU: 0.4339 - learning_rate: 3.0000e-04 - Trainable: 15.0000 - lapTime: 146.1071 Epoch 19/40 229/229 [==============================] - 146s 637ms/step - loss: 2.2278 - names_loss: 1.5023 - boxes_loss: 0.0093 - names_CategoricalAccuracy: 0.5850 - names_Precision: 0.8248 - names_Recall: 0.3405 - boxes_IoU: 0.6794 - val_loss: 3.4562 - val_names_loss: 2.7188 - val_boxes_loss: 0.0253 - val_names_CategoricalAccuracy: 0.3150 - val_names_Precision: 0.5694 - val_names_Recall: 0.1025 - val_boxes_IoU: 0.5156 - learning_rate: 3.0000e-04 - Trainable: 15.0000 - lapTime: 145.7970 Epoch 20/40 229/229 [==============================] - 146s 639ms/step - loss: 1.9692 - names_loss: 1.2624 - boxes_loss: 0.0082 - names_CategoricalAccuracy: 0.6568 - names_Precision: 0.8743 - names_Recall: 0.4139 - boxes_IoU: 0.6960 - val_loss: 3.2538 - val_names_loss: 2.5586 - val_boxes_loss: 0.0101 - val_names_CategoricalAccuracy: 0.3587 - val_names_Precision: 0.6053 - val_names_Recall: 0.1150 - val_boxes_IoU: 0.6700 - learning_rate: 9.0000e-05 - Trainable: 15.0000 - lapTime: 146.2284 Epoch 21/40 229/229 [==============================] - 146s 639ms/step - loss: 1.8194 - names_loss: 1.1385 - boxes_loss: 0.0078 - names_CategoricalAccuracy: 0.6949 - names_Precision: 0.8933 - names_Recall: 0.4537 - boxes_IoU: 0.7023 - val_loss: 3.1774 - val_names_loss: 2.5053 - val_boxes_loss: 0.0102 - val_names_CategoricalAccuracy: 0.3713 - val_names_Precision: 0.6121 - val_names_Recall: 0.1262 - val_boxes_IoU: 0.6514 - learning_rate: 9.0000e-05 - Trainable: 15.0000 - lapTime: 146.3510 Epoch 22/40 229/229 [==============================] - 145s 635ms/step - loss: 1.7542 - names_loss: 1.0949 - boxes_loss: 0.0075 - names_CategoricalAccuracy: 0.7074 - names_Precision: 0.8962 - names_Recall: 0.4737 - boxes_IoU: 0.7054 - val_loss: 3.1943 - val_names_loss: 2.5451 - val_boxes_loss: 0.0071 - val_names_CategoricalAccuracy: 0.3500 - val_names_Precision: 0.5920 - val_names_Recall: 0.1287 - val_boxes_IoU: 0.7078 - learning_rate: 9.0000e-05 - Trainable: 15.0000 - lapTime: 145.4780 Epoch 23/40 229/229 [==============================] - 146s 638ms/step - loss: 1.6745 - names_loss: 1.0340 - boxes_loss: 0.0075 - names_CategoricalAccuracy: 0.7282 - names_Precision: 0.9141 - names_Recall: 0.5023 - boxes_IoU: 0.7058 - val_loss: 3.1619 - val_names_loss: 2.5293 - val_boxes_loss: 0.0088 - val_names_CategoricalAccuracy: 0.3537 - val_names_Precision: 0.5989 - val_names_Recall: 0.1363 - val_boxes_IoU: 0.6797 - learning_rate: 9.0000e-05 - Trainable: 72.0000 - lapTime: 145.9828 Epoch 24/40 229/229 [==============================] - 146s 636ms/step - loss: 1.6201 - names_loss: 0.9972 - boxes_loss: 0.0075 - names_CategoricalAccuracy: 0.7421 - names_Precision: 0.9138 - names_Recall: 0.5221 - boxes_IoU: 0.7063 - val_loss: 3.1783 - val_names_loss: 2.5643 - val_boxes_loss: 0.0067 - val_names_CategoricalAccuracy: 0.3487 - val_names_Precision: 0.5979 - val_names_Recall: 0.1412 - val_boxes_IoU: 0.7175 - learning_rate: 9.0000e-05 - Trainable: 72.0000 - lapTime: 145.9611 Epoch 25/40 229/229 [==============================] - 146s 639ms/step - loss: 1.5777 - names_loss: 0.9705 - boxes_loss: 0.0072 - names_CategoricalAccuracy: 0.7414 - names_Precision: 0.9115 - names_Recall: 0.5244 - boxes_IoU: 0.7115 - val_loss: 3.1877 - val_names_loss: 2.5867 - val_boxes_loss: 0.0080 - val_names_CategoricalAccuracy: 0.3425 - val_names_Precision: 0.5677 - val_names_Recall: 0.1363 - val_boxes_IoU: 0.6849 - learning_rate: 9.0000e-05 - Trainable: 72.0000 - lapTime: 146.4161 Epoch 26/40 229/229 [==============================] - 146s 636ms/step - loss: 1.4814 - names_loss: 0.8849 - boxes_loss: 0.0068 - names_CategoricalAccuracy: 0.7684 - names_Precision: 0.9249 - names_Recall: 0.5651 - boxes_IoU: 0.7178 - val_loss: 3.1117 - val_names_loss: 2.5184 - val_boxes_loss: 0.0069 - val_names_CategoricalAccuracy: 0.3550 - val_names_Precision: 0.6078 - val_names_Recall: 0.1550 - val_boxes_IoU: 0.7144 - learning_rate: 2.7000e-05 - Trainable: 72.0000 - lapTime: 145.5804 Epoch 27/40 229/229 [==============================] - 1538s 7s/step - loss: 1.4552 - names_loss: 0.8655 - boxes_loss: 0.0064 - names_CategoricalAccuracy: 0.7789 - names_Precision: 0.9277 - names_Recall: 0.5757 - boxes_IoU: 0.7233 - val_loss: 3.1137 - val_names_loss: 2.5258 - val_boxes_loss: 0.0078 - val_names_CategoricalAccuracy: 0.3637 - val_names_Precision: 0.5969 - val_names_Recall: 0.1462 - val_boxes_IoU: 0.6953 - learning_rate: 2.7000e-05 - Trainable: 72.0000 - lapTime: 146.3405 Epoch 28/40 229/229 [==============================] - 145s 632ms/step - loss: 1.4039 - names_loss: 0.8204 - boxes_loss: 0.0064 - names_CategoricalAccuracy: 0.7983 - names_Precision: 0.9339 - names_Recall: 0.5862 - boxes_IoU: 0.7252 - val_loss: 3.1561 - val_names_loss: 2.5749 - val_boxes_loss: 0.0071 - val_names_CategoricalAccuracy: 0.3612 - val_names_Precision: 0.5698 - val_names_Recall: 0.1275 - val_boxes_IoU: 0.7081 - learning_rate: 2.7000e-05 - Trainable: 72.0000 - lapTime: 144.7082 Epoch 29/40 229/229 [==============================] - 1084s 5s/step - loss: 1.3720 - names_loss: 0.7928 - boxes_loss: 0.0062 - names_CategoricalAccuracy: 0.8091 - names_Precision: 0.9450 - names_Recall: 0.6090 - boxes_IoU: 0.7284 - val_loss: 3.0858 - val_names_loss: 2.5071 - val_boxes_loss: 0.0067 - val_names_CategoricalAccuracy: 0.3675 - val_names_Precision: 0.5842 - val_names_Recall: 0.1475 - val_boxes_IoU: 0.7142 - learning_rate: 8.1000e-06 - Trainable: 72.0000 - lapTime: 148.0910 Epoch 30/40 229/229 [==============================] - 147s 642ms/step - loss: 1.3552 - names_loss: 0.7780 - boxes_loss: 0.0062 - names_CategoricalAccuracy: 0.8106 - names_Precision: 0.9388 - names_Recall: 0.6111 - boxes_IoU: 0.7292 - val_loss: 3.0828 - val_names_loss: 2.5060 - val_boxes_loss: 0.0068 - val_names_CategoricalAccuracy: 0.3700 - val_names_Precision: 0.5970 - val_names_Recall: 0.1500 - val_boxes_IoU: 0.7131 - learning_rate: 8.1000e-06 - Trainable: 72.0000 - lapTime: 146.8632 Epoch 31/40 229/229 [==============================] - 148s 645ms/step - loss: 1.3628 - names_loss: 0.7877 - boxes_loss: 0.0061 - names_CategoricalAccuracy: 0.8077 - names_Precision: 0.9364 - names_Recall: 0.6167 - boxes_IoU: 0.7309 - val_loss: 3.0839 - val_names_loss: 2.5093 - val_boxes_loss: 0.0068 - val_names_CategoricalAccuracy: 0.3713 - val_names_Precision: 0.5784 - val_names_Recall: 0.1475 - val_boxes_IoU: 0.7147 - learning_rate: 8.1000e-06 - Trainable: 72.0000 - lapTime: 147.8460 Epoch 32/40 229/229 [==============================] - 146s 638ms/step - loss: 1.3590 - names_loss: 0.7861 - boxes_loss: 0.0060 - names_CategoricalAccuracy: 0.8102 - names_Precision: 0.9365 - names_Recall: 0.6123 - boxes_IoU: 0.7334 - val_loss: 3.0866 - val_names_loss: 2.5141 - val_boxes_loss: 0.0066 - val_names_CategoricalAccuracy: 0.3662 - val_names_Precision: 0.5911 - val_names_Recall: 0.1500 - val_boxes_IoU: 0.7166 - learning_rate: 8.1000e-06 - Trainable: 72.0000 - lapTime: 146.0911 Epoch 33/40 229/229 [==============================] - 146s 637ms/step - loss: 1.3517 - names_loss: 0.7802 - boxes_loss: 0.0060 - names_CategoricalAccuracy: 0.8049 - names_Precision: 0.9410 - names_Recall: 0.6116 - boxes_IoU: 0.7324 - val_loss: 3.0923 - val_names_loss: 2.5203 - val_boxes_loss: 0.0068 - val_names_CategoricalAccuracy: 0.3625 - val_names_Precision: 0.5874 - val_names_Recall: 0.1512 - val_boxes_IoU: 0.7147 - learning_rate: 2.4300e-06 - Trainable: 72.0000 - lapTime: 145.8044 Epoch 34/40 229/229 [==============================] - ETA: 0s - loss: 1.3320 - names_loss: 0.7610 - boxes_loss: 0.0059 - names_CategoricalAccuracy: 0.8158 - names_Precision: 0.9435 - names_Recall: 0.6285 - boxes_IoU: 0.7345 --------------------------------------------------------------- eStop initiated after epoch 33 for poor loss gradient of 0.192 --------------------------------------------------------------- 229/229 [==============================] - 146s 639ms/step - loss: 1.3320 - names_loss: 0.7610 - boxes_loss: 0.0059 - names_CategoricalAccuracy: 0.8158 - names_Precision: 0.9435 - names_Recall: 0.6285 - boxes_IoU: 0.7345 - val_loss: 3.0787 - val_names_loss: 2.5069 - val_boxes_loss: 0.0068 - val_names_CategoricalAccuracy: 0.3688 - val_names_Precision: 0.5805 - val_names_Recall: 0.1487 - val_boxes_IoU: 0.7128 - learning_rate: 7.2900e-07 - Trainable: 72.0000 - lapTime: 146.2075
2022-07-30 18:07:20.438553: W tensorflow/python/util/util.cc:368] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.
INFO:tensorflow:Assets written to: ./deployables/ResNet50V2_FINAL/ResNet50V2_FINAL/tfsave/assets
| name | target_size | batch_size | optimizer | patience | slope | factor | uncontrolled | schedule | learning_rate | lossWeights | epochs | verbose | logs | loss | names_loss | boxes_loss | names_CategoricalAccuracy | names_Precision | names_Recall | boxes_IoU | val_loss | val_names_loss | val_boxes_loss | val_names_CategoricalAccuracy | val_names_Precision | val_names_Recall | val_boxes_IoU | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | ResNet50V2_FINAL | (224, 224) | 32 | Adam | 24 | 0.25 | 0.3 | -15 | {22: 0.3} | 0.001 | {'names': 0.8, 'boxes': 0.19999999999999996} | 40 | 1 | {'loss': [13.368462562561035, 8.04307460784912... | 1.248332 | 0.677075 | 0.006295 | 0.901575 | 0.981873 | 0.726378 | 0.719278 | 3.068458 | 2.496808 | 0.006688 | 0.373008 | 0.688816 | 0.183267 | 0.715414 |
2022-07-30 18:07:31.939469: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.
samples from TRAINING SET
samples from TESTING SET
# visualise the final model in full topology
from tensorflow.keras.utils import plot_model
plot_model(pp.model,show_shapes=True,show_layer_activations=True,expand_nested=False)